
import { _decorator, Component, Node, url, assetManager, Asset, MeshRenderer, find } from 'cc';
const { ccclass, property } = _decorator;

// import "./libs/jszip"

// import foo from './libs/foo'

@ccclass('Jsziploader')
export class Jsziploader extends Component {

    testBundle: import("cc").AssetManager.Bundle;

    onLoad() {

        assetManager.loadBundle('asset_bundle', () => { //先加载bundle文件夹



            this.testBundle = assetManager.getBundle('asset_bundle');//加载完成后，获取到指定文件夹

            console.log(this.testBundle);

            //this.getEqCtrlListBundle(); //提前加载 设备 预制体 中资源

        });
    }



    getEqCtrlListBundle() {

        this.testBundle.load("ditu_zip",  (finished: number, total: number, item: any) => {

            //加载过程          
            var nmb = ((finished / total) * 100.00).toFixed(2) + '%';
            console.log(nmb);

        }, (err: Error | null, data: any) => {

            
            console.log(data.nativeUrl);

            var b_data=window.jsgetBinaryContent(data.nativeUrl)


            // let dimiancc = find("Plane");
            // var com = dimiancc.getComponent(MeshRenderer);
            // com.material.setProperty('mainTexture', data);//材质赋值

        }
        )



    }

}
